import Dialog from '../../../miniprogram_npm/@vant/weapp/dialog/dialog';
import {makeTeam} from '../../../utils/api'
Page({

  /**
   * 页面的初始数据
   */
  data: {
    teamDto:{
      "imtoken": "",
      "num": null,
      "projectId": "",
      "request": "",
      "teamName": "",
      "userId": "string"
    }
  },
  onChangeName(e){
    let teamName = this.data.teamDto
    teamName.teamName = e.detail
    this.setData({
      teamDto:teamName
    })
  },
  onChangeNum(e){
    let teamNum = this.data.teamDto
    teamNum.num = e.detail
    this.setData({
      teamDto:teamNum
    })
  },
  onChangeReq(e){
    let request = this.data.teamDto
    request.request = e.detail.value
    this.setData({
      teamDto:request
    })
  },
  makeTeam(){
    let userId = wx.getStorageSync('userId')
    console.log(this.data.teamDto);
    // makeTeam
  },
  toAddTeamMate:function(){
    this.makeTeam()
    Dialog.confirm({
      title: '提示',
      message: '你的团队已创建，是否为团队招募成员？',
    })
      .then(() => {
        wx.navigateTo({
          url: '../addTeammate/addTeammate',
        })
      })
      .catch(() => {
        wx.switchTab({
          url: '../add/add',
        })
      });
  },
  onChange(event) {
    // event.detail 为当前输入的值
    console.log(event.detail);
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },
})